-
Notifications
You must be signed in to change notification settings - Fork 65
Fallback to Host ID if WEBSITE_SITE_NAME isn't defined #1178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request implements a fallback mechanism for determining the function’s unique identifier by using the host ID when the WEBSITE_SITE_NAME configuration is not set, improving the local development experience. Key changes include:
- Updating various methods and parameter names to reflect the new fallback strategy (e.g. renaming GetPrimaryKeyColumnsAsync to GetPrimaryKeyColumns, GetUserFunctionId to GetWebsiteSiteNameFunctionId, and GetOldUserFunctionIdAsync to GetHostIdFunctionIdAsync).
- Adjusting SQL migration logic in the leases table creation to use the host ID where WEBSITE_SITE_NAME isn’t configured.
- Removing the WEBSITE_SITE_NAME setting from the samples and updating documentation accordingly.
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
test/Integration/SqlTriggerBindingIntegrationTests.cs | Added a new test to verify functionality when WEBSITE_SITE_NAME is defined. |
src/TriggerBinding/SqlTriggerUtils.cs | Renamed the method to better reflect its sync behavior. |
src/TriggerBinding/SqlTriggerMetricsProvider.cs | Updated the method call to use the refactored primary key logic. |
src/TriggerBinding/SqlTriggerListener.cs | Refactored parameter names and added migration logic for lease tables. |
src/TriggerBinding/SqlTriggerBinding.cs | Updated function ID resolution logic to use WEBSITE_SITE_NAME and host ID fallback. |
src/SqlBindingUtilities.cs | Removed the GetWebSiteName method to align with the new fallback approach. |
samples/* | Removed WEBSITE_SITE_NAME from local settings to simplify configuration. |
docs/TriggerBinding.md & docs/BindingsOverview.md | Updated documentation to explain the new fallback behavior. |
Comments suppressed due to low confidence (1)
src/TriggerBinding/SqlTriggerListener.cs:413
- Ensure that the migration logic using _hostIdFunctionId correctly covers all use cases when WEBSITE_SITE_NAME is not set, and verify that the fallback behavior aligns with intended function state management.
SELECT @lastSyncVersion = LastSyncVersion from az_func.GlobalState where UserFunctionID = '{this._hostIdFunctionId}' AND UserTableID = {userTableId}
Closes #1179
We got feedback that requiring WEBSITE_SITE_NAME wasn't very friendly to the local development experience, so instead of throwing an error we'll just fall back to the original
hostIdProvider.GetHostIdAsync
call.This should be fine, since deployed functions should ALWAYS have a site name (set by the host environment) - and for local functions the only thing being lost is consumption scaling which doesn't apply anyways.
I decided to remove the setting from the samples, since generally we shouldn't expect people to need to define it anymore. And then I added a new test that does specifically set it to make sure that things still work as expected.